package com.syxbyi.hmwk1.main;

import javax.swing.*;
import java.util.Random;

/**
 * 使用双重循环实现五子棋游戏棋盘的绘制
 */
public class Gobang {
    protected final int ROW = 16;
    protected final int COL = 16;
    protected final int[][] board = new int[ROW + 1][COL + 1];
    protected final char[] header = new char[ROW + 1];

    public Gobang() {
        // gen header
        header[0] = ' ';
        for (int i = 0; i < 10; i++) {
            header[i + 1] = (char)('0' + i);
            if (i < 6) {
                header[11 + i] = (char)('a' + i);
            }
        }
        // gen chess board
        board[0][0] = header[0];
        for (int i = 1; i <= ROW; i++) {
            board[i][0] = header[i];
            for (int j = 1; j <= COL; j++) {
                board[0][j] = header[j];
                board[i][j] = '+';
            }
        }
    }

    public int[][] getBoard() {
        return board;
    }

    public void printBoard() {
        for (int i = 0; i <= ROW; i++) {
            for (int j = 0; j <= COL; j++) {
                System.out.print((char)board[i][j] + "  ");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        Gobang gobang = new Gobang();
        gobang.printBoard();
    }
}
